import Vue from "vue";
import Router from "vue-router";
import Home from "../pages/home/Home.vue";
import City from "../pages/city/City.vue";
import Deatil from "../pages/detail/detail";

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: "/",
      name: "Home", // 主页路由
      component: Home
    },
    {
      path: "/city",
      name: "City", // 城市页面路由
      component: City
    },
    {
      path: "/detail/:id",
      name: "Detail",
      component: Deatil
    }
  ],
  scrollBehavior(to, from, savedPosition) {
    // return 期望滚动到哪个的位置
    return { x: 0, y: 0 };
  }
});
